"use strict";
require([
    './dev/tool',
    './conf/urlObj',
    'text!tpl/selectTim.hbs',
    'text!tpl/upTim.hbs',
    './dev/handleChart'
], function (tool, urlObj, selectTim, upTim, handleChart) {

    layui.use(['layer','table', 'element', 'form', 'laydate', 'upload'],  () => {
      const  $ = layui.jquery,
        table = layui.table,
        element = layui.element,
        layer = layui.layer,
        laydate = layui.laydate,
        upload = layui.upload,
        form = layui.form;


      //显示当前操作用户名
      handleChart.setUserName($, "#userName");
      //设置默认查询时间
      handleChart.setDefdate($, form, laydate, "dataQry")
      // 单行操作（编辑/删除）
      handleChart.handeTool($, form, table,'tool(test)', '真的删除行么', 'exampleEdit', "/xcj/vegetables/listInfo", "tabConf", "/xcj/vegetables/changeFlag", "getPriceList", "vegetable")
      //工具行操作（审核提交/退回修改/批量删除/新增/复制新增）
      handleChart.toolbarPrice($, form, table, laydate, upload,'toolbar(test)', "没有选中指定的信息", 'exampleEdit', urlObj, "/xcj/vegetables/listInfo", "tabConf", ["/xcj/vegetables/changeState", "/xcj/vegetables/changeFlag", "/xcj/vegetables/addVegetable", "/xcj/vegetables/updateVegetables"], "getPriceList", "vegetable", "dataQry", selectTim, "dataUp", upTim);
      //查询表单(信息录入)
      handleChart.getPriceList($, table, urlObj, "/xcj/vegetables/listInfo", "tabConf");
      //退出登录
      tool.exitHandle($, "exitBtn", ["id", "bazaarIds", "token", "username", "capacityIds", "roleName", "byName"], "login.html");
      //根据表单条件查询数据（信息录入/汇总统计）
      handleChart.SubmitBatch($, table, form, "filterQry", "/xcj/vegetables/listInfo", "tabConf", 0, "vegetable")
      //编辑一条数据
      handleChart.submitAddPrice($, table, form, "demo5", handleChart['putEditInfo'], "/xcj/vegetables/updateVegetable", "tabConf", "/xcj/vegetables/listInfo",  "getPriceList", "vegetable")
      //监听单元格编辑
      handleChart.listenTab($, table, 'edit(test)');

    });


});
